import request from '@/utils/request'

// 查询公司列表
export function listCompany(query) {
  return request({
    url: '/system/company/list',
    method: 'get',
    params: query
  })
}


// 查询公司列表 树状结构
export function treeCompany(query) {
  return request({
    url: '/system/company/treeList',
    method: 'get',
    params: query
  })
}

// 查询公司详情
export function companyInfo(id) {
  return request({
    url: '/system/company/' + id,
    method: 'get',
  })
}

// 新增公司
export function addCompany(data) {
  return request({
    url: '/system/company',
    method: 'post',
    data: data
  })
}

// 更新公司
export function updateCompany(data) {
  return request({
    url: '/system/company/self',
    method: 'put',
    data: data
  })
}

// 删除公司
// export function delCompany(data) {
//   return request({
//     url: '/system/company',
//     method: 'delete',
//     data: data
//   })
// }

// 公司状态更换
export function statusChange(status, cid) {
  return request({
    url: '/system/company/status/' + status + "/" + cid,
    method: 'put',
  })
}


// 股东分红
export function dividendCmpList(query) {
  return request({
    url: '/system/company/dividend',
    method: 'get',
    params: query
  })
}

// 股东分红
export function dividendCmp(data) {
  return request({
    url: '/system/company/dividend',
    method: 'post',
    data: data
  })
}

// 查看运营商团队
export function teamInfo(query) {
  return request({
    url: '/system/company/team',
    method: 'get',
    params: query
  })
}

// 查看运营商团队
export function teamsInfo(companyId) {
  return request({
    url: '/system/company/team/' + companyId,
    method: 'get',
  })
}

// 查看运营商股东进度
export function shareHolder() {
  return request({
    url: '/system/company/shareHolderAssess',
    method: 'post'
  })
}

// 更换主体上级
export function editSuperior(data) {
  return request({
    url: '/system/company/editSuperior',
    method: 'post',
    data: data
  })
}

// 升级最高主体
export function editSuperiorUp(data) {
  return request({
    url: '/system/company/editSuperiorUp',
    method: 'post',
    data: data
  })
}


// 更新主体个人业绩
export function editAchievement(companyId, achievement) {
  return request({
    url: '/system/company/achievement/' + companyId + "/" + achievement,
    method: 'put',
  })
}

// 更新主体贡献值
export function editContribution(companyId, contribution) {
  return request({
    url: '/system/company/contribution/' + companyId + "/" + contribution,
    method: 'put',
  })
}
